package com.java复习.练习一二四答案.demo5;

//多边形类
public class Ploygon {
    int sides;
    double area;

    public Ploygon(int sides){
        this.sides = sides;
        System.out.println("调用了父类的构造方法");
    }

    public int getNumberOfSides(){
        System.out.println("多边形的边数是："+this.sides);
        return this.sides;
    }

    public String toString(){
        return "这是一个"+this.sides+"边形,其面积是："+this.area;
    }
}
